import { Controller, Get, HttpStatus, Query, Req, Res } from "@nestjs/common";
import { WechatService } from "./wechat.service";
import { ValidationDto } from "./dto/validation.dto";
import { Public } from "@/common/decorators/public.decorator";
import { Response } from "express";

@Controller("wechat")
export class WechatController {
	constructor(private readonly wechatService: WechatService) {}

	@Public()
	@Get("valid")
	async checkSignature(@Query() queryObj: ValidationDto, @Res() res: Response) {
		console.log("打印***obj", queryObj);
		const result = await this.wechatService.checkSignature(queryObj);
		res.header("Content-Type", "text/plain");
		res.status(HttpStatus.OK).send(result);
	}
}
